﻿using Authorization.Center.Controllers;
using Authorization.Center.SqlServer;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.ReportForms.Domain.Dto;
using static S.ReportForms.Read.API.Application.Command.SheepSoredInRealTimeCommand;

namespace S.ReportForms.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepStoredInRealController : BaseController
    {
        private readonly IMediator mediator;

        public SheepStoredInRealController(MySqlDbContext _db, IMediator mediator) : base(_db)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取羊场实时总存栏
        /// </summary>
        /// <param name="sheepSoredInRealTimeCommand"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<SheepStoredInRealTimeDto> GetSheepTotalCountInReal(SheepSoredInRealTimeTotalCountCommand sheepSoredInRealTimeCommand)
        {
            return await mediator.Send(sheepSoredInRealTimeCommand);
        }
        /// <summary>
        /// 种公详情
        /// </summary>
        /// <param name="sheepFatherDetailCommand"></param>
        /// <returns></returns>
        [Authorize]
        [HttpGet]
        public async Task<List<BreedFatherDetailDto>> GetBreedFatherDetailDtos()
        {
            SheepFatherDetailCommand sheepFatherDetailCommand = new SheepFatherDetailCommand();
            return await mediator.Send(sheepFatherDetailCommand);
        }
        /// <summary>
        /// 后裔详情
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<List<BreedChildDto>> GetBreedChildDtos()
        {
            BreedChildCommand command=new BreedChildCommand();
            return await mediator.Send(command);
        }
        /// <summary>
        /// 获取种母
        /// </summary>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<List<BreedMotherDto>> GetBreedMotherDto()
        {
            BreedMotherCommand command = new BreedMotherCommand();
            return await mediator.Send(command);
        }
        /// <summary>
        /// 获取种母存栏详情
        /// </summary>
        /// <param name="motherDetailCommand"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<MotherPageDto> GetMothersDetaile(MotherDetailCommand motherDetailCommand)
        {
            return await mediator.Send(motherDetailCommand);
        }
        /// <summary>
        /// 获取种公存栏详情
        /// </summary>
        /// <param name="motherDetailCommand"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<FatherPageDto> GetFathersDetaile(FatherDetailCommand fatherDetailCommand)
        {
            return await mediator.Send(fatherDetailCommand);
        }


    }
}
